import React, { Component } from 'react';
import {
    View,
    Text,
    TouchableOpacity,
} from 'react-native';

import { resumefourStyle as styles } from '../../../../../styles';
import Icon from 'react-native-vector-icons/Ionicons';
import fmt from '../../../../util/fmtDateUtil';

export default class Re_experience4_1 extends Component {
    // 初始化模拟数据
    constructor(props) {
        super(props);
    }
    render() {
        return (
            <View style={styles.listfour}>
                <View style={styles.ninesp}>
                    <View style={styles.fourallin}>
                        <View style={styles.fourev1}>
                            <Text style={styles.fourtxt1}>{this.props.jobExp.jobexpPostion}</Text>
                            <Text style={styles.fourtxt1}>{this.props.jobExp.jobexpCompanyName}</Text>
                            <Text style={styles.fourtxt1}>（<Text>{fmt(this.props.jobExp.jobexpBeginTime, 'yyyy-MM-dd')}</Text>-<Text>{fmt(this.props.jobExp.jobexpEndTime, 'yyyy-MM-dd')}</Text>）</Text>
                        </View>

                        <View style={styles.fourev2}>
                            <Text style={styles.fourtxt2}>工作地点：<Text style={styles.fourtxt1}>{this.props.jobExp.jobexpWorkspace}</Text></Text>
                            <Text style={styles.fourtxt2}>月薪：<Text style={styles.fourtxt1}>{this.props.jobExp.jobexpMm}</Text></Text>
                        </View>
                        <Text style={styles.fourev3}>公司领域：<Text style={styles.fourtxt1}>{this.fieldName(this.props.jobExp.fields, 3)}</Text></Text>
                        <Text style={styles.fourev3}>职责业绩：<Text style={styles.fourtxt1}>{this.props.jobExp.jobexpDuty}</Text></Text>

                    </View>

                    <TouchableOpacity
                        style={styles.touch} activeOpacity={1}
                        onPress={() => { this.goGet('Rexpedit', this.props.resume, this.props.jobExp, this.props.actions) }}>
                        <Icon
                            name={'md-create'}
                            size={16}
                            color={'#3d9ccc'} />
                    </TouchableOpacity>
                </View>
            </View>
        );
    }
    //经营领域
    fieldName(List, sl) {
        var data = {
            cont: List
        }
        var arr = '';
        var s = sl;
        var length = data.cont.length;
        if (length <= s) {
            s = length;
        }
        for (var i = 0; i < s; i++) {
            arr += data.cont[i].fieldName + '/';
        }
        if (arr.endsWith('/')) {
            arr = arr.substr(0, arr.length - 1);
        }
        return arr;
    }

    goGet(name, object, jobExp, action) {
        this.props.navigation.navigate(name, { resume: object, jobExp: jobExp, actions: action });
    }

}